package com.openbravo.pos.printer.screen;

import com.openbravo.pos.forms.AppLocal;
import com.openbravo.pos.printer.DevicePrinter;
import com.openbravo.pos.printer.ticket.BasicTicket;
import com.openbravo.pos.printer.ticket.BasicTicketForScreen;
import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class DevicePrinterPanel extends JPanel
  implements DevicePrinter
{
  private String m_sName;
  private JTicketContainer m_jTicketContainer;
  private BasicTicket m_ticketcurrent;
  private JScrollPane m_jScrollView;

  public DevicePrinterPanel()
  {
    initComponents();
    this.m_sName = AppLocal.getIntString("Printer.Screen");
    this.m_ticketcurrent = null;
    this.m_jTicketContainer = new JTicketContainer();
    this.m_jScrollView.setViewportView(this.m_jTicketContainer);
  }

  public String getPrinterName()
  {
    return this.m_sName;
  }

  public String getPrinterDescription()
  {
    return null;
  }

  public JComponent getPrinterComponent()
  {
    return this;
  }

  public void reset()
  {
    this.m_ticketcurrent = null;
    this.m_jTicketContainer.removeAllTickets();
    this.m_jTicketContainer.repaint();
  }

  public void beginReceipt()
  {
    this.m_ticketcurrent = new BasicTicketForScreen();
  }

  public void printImage(BufferedImage paramBufferedImage)
  {
    this.m_ticketcurrent.printImage(paramBufferedImage);
  }

  public void printBarCode(String paramString1, String paramString2, String paramString3)
  {
    this.m_ticketcurrent.printBarCode(paramString1, paramString2, paramString3);
  }

  public void beginLine(int paramInt)
  {
    this.m_ticketcurrent.beginLine(paramInt);
  }

  public void printText(int paramInt, String paramString)
  {
    this.m_ticketcurrent.printText(paramInt, paramString);
  }

  public void endLine()
  {
    this.m_ticketcurrent.endLine();
  }

  public void endReceipt()
  {
    this.m_jTicketContainer.addTicket(new JTicket(this.m_ticketcurrent));
    this.m_ticketcurrent = null;
  }

  public void openDrawer()
  {
    Toolkit.getDefaultToolkit().beep();
  }

  private void initComponents()
  {
    this.m_jScrollView = new JScrollPane();
    setLayout(new BorderLayout());
    add(this.m_jScrollView, "Center");
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.printer.screen.DevicePrinterPanel
 * JD-Core Version:    0.6.0
 */